/*
 * @Author: rock
 * @Date: 2025-04-19 09:59:29
 * @LastEditors: rock 
 * @LastEditTime: 2025-04-19 11:31:21
 * @FilePath: /007loggerlib/main/main.cpp
 * @Description: 
 * 
 * Copyright (c) 2025 by rock, All Rights Reserved. 
 */

 #include "logger.hpp"

 void func01()
 {
 
     try
     {
         //log输出文件
         Logger logger("../log/log.txt");
 
         // 单行不使用{}
         logger.log(LogLevel::DEBUG, "starting application...");
 
         // 多行使用{}
         // 日志参数
         int user_id = 42;             // 用户 : id
         std::string action = "login"; // 行为 : 登录
         double duration = 3.5;        // 持续时间
         std::string world = "WORLD";  // 登录服务器
 
         // 三个花括号替换
         logger.log(LogLevel::DEBUG,"User {} performed {} in {} seconds", user_id, action, duration);
         // 第四个参数没有花括号
         logger.log(LogLevel::DEBUG, "User {} performed {} in {} seconds", user_id, action, duration, world);
 
         // 没有{}替换的
         logger.log(LogLevel::DEBUG, "Hello , This is a message , without any placeholders.");
     }
     catch (const std::exception e)
     {
         std::cerr << "Error : " << e.what() << std::endl;
     }
 }
 
 int main(void)
 {
     func01();
     return 0;
 }
 